package mirrormonkey.commons.graph;

import mirrormonkey.commons.transform.TransformUpdateControl;
import mirrormonkey.framework.entity.EntityData;
import mirrormonkey.framework.entity.SyncEntity;
import mirrormonkey.rpc.RpcSpecification;

import com.jme3.scene.Node;
import com.jme3.scene.Spatial;

public class SynchronizedNode extends Node implements SyncEntity,
		RpcSpecification {

	public TransformUpdateControl transformControl;

	protected EntityData data;

	public SynchronizedNode(TransformUpdateControl transformControl) {
		this.transformControl = transformControl;
		addControl(transformControl);
	}

	@Override
	public int attachChild(Spatial child) {
		checkSyncChildAdd(child);
		return super.attachChild(child);
	}

	@Override
	public int attachChildAt(Spatial child, int index) {
		checkSyncChildAdd(child);
		return super.attachChild(child);
	}

	@Override
	public int detachChild(Spatial child) {
		checkSyncChildRemove(child);
		return super.detachChild(child);
	}

	@Override
	public void setData(EntityData data) {
		this.data = data;
	}

	@Override
	public EntityData getData() {
		return data;
	}

}
